package com.hyacinth.core.sysmgr.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.hyacinth.common.framework.Domain;

@Entity
@Table(name="sys_role")
public class SysRole extends Domain {

	private static final long serialVersionUID = 2146398027208521024L;

	private String name;
	
	private String alias;
	
	private List<SysMenu> menus;

	@Column(length=20, name="name")
	public String getName() {
		return name;
	}

	@ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(name="sys_role_menu",joinColumns=@JoinColumn(name="role_id"),inverseJoinColumns=@JoinColumn(name="menu_id"))
	public List<SysMenu> getMenus() {
		return menus;
	}

	@Column(length=20, name="alias", nullable=false)
	public String getAlias() {
		return alias;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}
	
	public void setMenus(List<SysMenu> menus) {
		this.menus = menus;
	}
}
